
namespace Patterns4Net.Core.Patterns
{
    using Mono.Cecil;
    using Attributes.DesignPatterns;

    /// <summary>
    /// Represents the Bridge design pattern.
    /// </summary>
    [Immutable]
    public class Bridge : PatternBase, IWrapper
    {
        public Bridge(TypeDefinition bridgeType, TypeReference target, TypeReference wrappedType)
        {
            this.BridgeType = bridgeType;
            this.Implementor = target;
            this.WrappedType = wrappedType;
        }

        public TypeDefinition BridgeType { get; private set; }

        public TypeReference WrappedType { get; private set; }

        public TypeReference Implementor { get; private set; }

        #region IWrapper Members

        TypeReference IWrapper.WrappedType
        {
            get { return this.WrappedType; }
        }

        TypeReference IWrapper.TargetInterface
        {
            get { return this.Implementor; }
        }

        TypeDefinition IWrapper.WrapperType
        {
            get { return this.BridgeType; }
        }

        #endregion
    }
}
